<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2023/1/2
  Time: 22:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/bootstrap-5.1.3-dist/css/bootstrap.css">
    <script type="text/javascript" src="/static/bootstrap-5.1.3-dist/js/bootstrap.js"></script>
    <title>我的收藏</title>
</head>

<style>
    .back{
        position: absolute;
        font-size: 26px;
        top:30px;
        left:40px;
        text-decoration: none;
        color: #000;
        font-weight: bold;
    }
    .back:hover{
        color: #000;
    }

    h2{
        text-align: center;
        margin-top: 15px;
    }

    .card{
        width: 1400px;
        height: 700px;
        background-color: #fffdfd;
        border-radius: 30px;
        border: none;
        box-shadow: 5px 5px 10px #adabab;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
    }
    table {
        text-align: center;
        vertical-align: middle !important;
        word-wrap:break-all;
        word-break:break-all;
        table-layout:fixed;

        width: 90% !important;
        margin-left: 80px;
        margin-top: 30px;

    }
    .page {
        height: 50px;
        /*width: 1270px;*/
        /*margin-left: 1400px;*/
        position: fixed;
        bottom: 180px;
        right: 200px;
    }

</style>
<body>
<a href="${pageContext.request.contextPath}/post_list" class="back">
    <span><</span>返回</a>
<h2>我的收藏</h2>
<div class="card">
    <table id="test" class="table table-bordered table-striped">
        <colgroup>
            <col width="100">
            <col width="200">
            <col width="150">
            <col width="150">
        </colgroup>
        <thead>
        <tr>
            <th>发帖人</th>
            <th>主题</th>
            <th>时间</th>
            <th>取消收藏</th>

        </tr>
        </thead>
        <tbody>
        <c:forEach items="${postList}" var="post" varStatus="s">
            <c:forEach items="${userList}" var="user" varStatus="s1">
                <c:if test="${user.id == post.userid}">
                    <tr>
                        <td>${user.username}</td>
                        <td><a href="commentList?pid=${post.id}"} class=" btn-outline-secondary">${post.title}</a></td>
                        <td>${post.date}</td>
                        <td><a href="del_collect?pid=${post.id}" class="btn btn-outline-danger">取消收藏</a></td>
                    </tr>
                </c:if>
            </c:forEach>
        </c:forEach>
        </tbody>
    </table>
</div>

<div class="page">
    <nav aria-label="Page navigation example">
        <ul class="pagination justify-content-between">
            <c:if test="${pageInfo.isLast && falg == null}">
                <li><a href="collec_post?page=${pageInfo.pageIndex-1}" class="page-link"><span
                        aria-hidden="true">&larr;</span> 上一页</a></li>
            </c:if>
            <c:if test="${pageInfo.isNext && falg == null}">
                <li><a href="collec_post?page=${pageInfo.pageIndex+1}" class="page-link">下一页 <span
                        aria-hidden="true">&rarr;</span></a></li>
            </c:if>

        </ul>
        <span>第 ${pageInfo.pageIndex} 页/共 ${pageInfo.sumCount} 页</span>
    </nav>
</div>

</body>
</html>
